from multiprocessing import Process
import time
import os


def task(name):
    print('{} is running!'.format(name))
    print('子进程id: {}, 父进程id: {}'.format(os.getpid(), os.getppid()))
    time.sleep(3)
    print('{} is done!'.format(name))


if __name__ == '__main__':
    print('主进程id: {}'.format(os.getpid()))
    # p = Process(target=task, args=('t1', ))
    p = Process(target=task, kwargs={'name': 't1'})
    p.start()
    print('---主进程----')


